
// lazy用于懒加载组件
// 采用懒加载的路由组件，必须要配合Suspense组件才能显示
// import { lazy } from "react";

// const Home = lazy(()=>import('../views/1_Home/home'))
// const About = lazy(()=>import('../views/2.1_路由跳转1_关于/about'))
// const City = lazy(()=>import('../views/2.2路由跳转页1_城市/city'))
// const Phone = lazy(()=>import('../views/2.3路由跳转页2_手机/phone'))
// const First = lazy(()=>import('../views/3_路由嵌套,多级路由/first'))
// const {Page1, Page2, Page3, Page4}  = lazy(()=>import('../views/3_路由嵌套,多级路由/first'))
// const NotFount = lazy(()=>import('../views/路由未识别404页面/notFount'))
// const MyPage1 = lazy(()=>import('../views/4_Redux状态管理器/page1'))
// const MyPage2 = lazy(()=>import('../views/5_Mobx状态管理器/page2'))
// const MyPage3 = lazy(()=>import('../views/6_配置代理服务器-第三方组件库应用/page3'))
// const MyPage4 = lazy(()=>import('../views/7_富文本编辑器/page4'))

import Home from '../views/1_Home/home'
import About from "../views/2.1_路由跳转1_关于/about";
import City from "../views/2.2路由跳转页1_城市/city";
import Phone from "../views/2.3路由跳转页2_手机/phone";
import First, {Page1, Page2, Page3, Page4} from "../views/3_路由嵌套,多级路由/first"
import NotFount from '../views/路由未识别404页面/notFount'
import MyPage1 from "../views/4_Redux状态管理器/page1"
import MyPage2 from "../views/5_Mobx状态管理器/page2"
import MyPage3 from "../views/6_配置代理服务器-第三方组件库应用/page3"
import MyPage4 from "../views/7_富文本编辑器/page4"

// const arr = [{path : '/',element:<Home></Home>},{path : '/about',element:<About></About>}]
// const routesList = []
// arr.map(item =>{
//     routesList.push(item)
// })
// 1、准备一个路由数组，数组中定义所有路由的相对关系
const routesList = [
    {
        path : '/',
        meta : {
            aaa: '权限'
        },
        element : <Home></Home>
        // element: lazy(()=>import('../views/1_Home/home'))
        // element: ()=>import('../views/1_Home/home')
    },
    {
        path : '/about',
        element : <About></About>
        // element:lazy(()=>import('../views/2.1_路由跳转1_关于/about'))
    },
    {
        path : '/city',
        element : <City></City>
        // element:lazy(()=>import('../views/2.2路由跳转页1_城市/city'))
    },
    {
        path : '/phone/:id',
        element: <Phone></Phone>
        // element:lazy(()=>import('../views/2.3路由跳转页2_手机/phone'))
    },
    {
        path : '/first',
        element: <First/>,
        // element:lazy(()=>import('../views/3_路由嵌套,多级路由/first')),
        children:[
            {
                element : <Page1></Page1>,
                index : true // index设置为true 变成默认的二级路由
            },
            {
                path : 'page2',
                element : <Page2></Page2>,
                children:[
                    {
                        element : <Page3></Page3>,
                        index : true
                    },
                    {
                        path : 'page4',
                        element:  <Page4></Page4>
                    }
                ]

            }
        ]
    },
    {
        path : '/page1',
        element: <MyPage1/>
        // element:lazy(()=>import('../views/4_Redux状态管理器/page1'))
    },
    {
        path:'/page2',
        element: <MyPage2/>
        // element:lazy(()=>import('../views/5_Mobx状态管理器/page2'))
    },
    {
        path:'/page3',
        element: <MyPage3/>
        // element:lazy(()=>import('../views/6_配置代理服务器-第三方组件库应用/page3'))
    },
    {
        path:'/page4',
        element: <MyPage4/>
        // element:lazy(()=>import('../views/7_富文本编辑器/page4'))
    },
    {
        path:'*',
        element: <NotFount/>
        // element:lazy(()=>import('../views/路由未识别404页面/notFount'))
    }
]

console.log(routesList)
export default routesList


